package com.hsz.motion.ui.fragment;
import android.os.Bundle;
import android.view.View;
import com.hsz.motion.R;
import com.hsz.motion.databinding.FragmentSportrecorddetailsBinding;
import com.hsz.motion.ui.BaseFragment;
import com.hsz.motion.commmon.bean.PathRecord;
import com.hsz.motion.sport_motion.MotionUtils;
import com.hsz.motion.ui.activity.SportRecordDetailsActivity;
import java.text.DecimalFormat;

/**
 * 运动记录详情-详情
 */
public class SportRecordDetailsFragment extends BaseFragment {
    private FragmentSportrecorddetailsBinding mBinding;
    private PathRecord pathRecord = null;
    private DecimalFormat decimalFormat = new DecimalFormat("0.00");
    private DecimalFormat intFormat = new DecimalFormat("#");
    @Override
    public int getLayoutId() {
        return R.layout.fragment_sportrecorddetails;
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        mBinding= (FragmentSportrecorddetailsBinding) mBaseBinding;
        Bundle bundle = getArguments();
        if (bundle != null) {
            pathRecord = bundle.getParcelable(SportRecordDetailsActivity.SPORT_DATA);
        }
        if (null != pathRecord) {
            mBinding.tvDistance.setText(decimalFormat.format(pathRecord.getDistance() / 1000d));
            mBinding.tvDuration.setText(MotionUtils.formatseconds(pathRecord.getDuration()));
            mBinding.tvSpeed.setText(decimalFormat.format(pathRecord.getSpeed()));
            mBinding.tvDistribution.setText(decimalFormat.format(pathRecord.getDistribution()));
            mBinding.tvCalorie.setText(intFormat.format(pathRecord.getCalorie()));
        }
    }

    @Override
    public void initListener() {

    }

    @Override
    public void onClick(View v) {

    }
}
